/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.bff.designtime.generator.api.entityinterface;

import com.inspur.edp.bff.designtime.generator.api.VmApiGenContext;
import com.inspur.edp.bff.designtime.generator.api.entityinterface.entityinfo.VoEntityInfoGenerator;
import com.inspur.edp.bff.designtime.generator.api.entityinterface.resourceinfo.BffEntityResourceInfoGenerator;
import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
import com.inspur.edp.cef.api.dataType.base.ICefDataType;
import com.inspur.edp.cef.api.dataType.entity.ICefRootEntity;
import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.dataTypeInfo.DataTypeInfoGenerator;
import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.resourceInfo.EntityResourceInfoGenerator;
import com.inspur.edp.cef.generator.apiGenerator.entity.separateInterface.EntityInterfaceGenCtx;
import com.inspur.edp.cef.generator.apiGenerator.entity.separateInterface.EntityInterfaceGenerator;
import com.inspur.edp.das.commonmodel.IGspCommonObject;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;

public class VoEntityInterfaceGenerator extends EntityInterfaceGenerator {

  private static final String NameSuffix = "VoBizEntity";
  private VmApiGenContext apiGenContext;
  private IGspCommonObject commonObject;

  public VoEntityInterfaceGenerator(VmApiGenContext apiGenContext, IGspCommonObject commonObject) {
    super(apiGenContext, commonObject);
    this.apiGenContext = apiGenContext;
    this.commonObject = commonObject;
  }

  public static String getName(IGspCommonObject node) {
    return "I" + node.getCode() + NameSuffix;
  }

  @Override
  protected java.util.ArrayList<ModifierKeyword> getAccessModifier() {
    return new java.util.ArrayList<ModifierKeyword>(
        java.util.Arrays.asList(ModifierKeyword.PUBLIC_KEYWORD));
  }

  @Override
  protected String getName() {
    return getName(commonObject);
  }

  @Override
  protected EntityInterfaceGenerator createChildEntityGenerator(IGspCommonObject childObject) {
    return new VoEntityInterfaceGenerator(apiGenContext, childObject);
  }

  //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods are not converted by C# to Java Converter:
  @Override
  protected DataTypeInfoGenerator createDataTypeInfoGenerator() {
//    return new VoEntityInfoGenerator((EntityInterfaceGenCtx) getContext());
    return null;
  }
  @Override
  protected EntityResourceInfoGenerator createResourceInfoGenerator() {
    return new BffEntityResourceInfoGenerator(getContext(), commonObject);
  }

//  @Override
//  protected ArrayList<TypeInfo> addParentInterfaces() {
//    if (apiGenContext.getCommonModel().isSimplifyGen()) {
//      return new ArrayList<>(Arrays.asList(new TypeInfo(ICefDataType.class), new TypeInfo(ICefRootEntity.class)));
//    }
//    return null;
//  }
}
